/*
 * @lc app=leetcode.cn id=2248 lang=javascript
 *
 * [2248] 多个数组求交集
 */

// @lc code=start
/**
 * @param {number[][]} nums
 * @return {number[]}
 */
var intersection = function (nums) {
  const objMap = {};

  for (const numList of nums) {
    for (const num of numList) {
      objMap[num] = (objMap[num] || 0) + 1;
    }
  }

  const rel = [];
  for (const key in objMap) {
    if (objMap[key] === nums.length) {
      rel.push(Number(key));
    }
  }

  return rel;
};
// @lc code=end
